import typescript from "@rollup/plugin-typescript";
import dts from 'rollup-plugin-dts'
import {nodeResolve} from "@rollup/plugin-node-resolve";
import commonJs from "@rollup/plugin-commonjs";
import esbuild from 'rollup-plugin-esbuild'
import vuePlugin from "rollup-plugin-vue";
import VueSetupExtend from "unplugin-vue-setup-extend/rollup";
import {defineConfig} from 'rollup'
import less from 'rollup-plugin-less'

export default defineConfig({
    input: './src/plugin/route-plan/route-plan.vue',
    output: {
        name: 'lib',
        file: 'dist/plugin/route-plan.js',
        format: 'umd',
        globals: 'RoutePlan'
    },
    plugins: [
        vuePlugin(),
        VueSetupExtend(),
        nodeResolve(),

        less(),
        // typescript({
        //     declaration: true,
        //     declarationDir: "./types",
        // }),
        esbuild({
            target: 'es2018',
            minify: true,
            include: /\.[jt]sx?$/,
            loaders: {
                '.vue': 'ts'
            }
        }),
        dts({
            tsconfig: './tsconfig.json'
        }),
        commonJs()
    ],
    external: ['vue']
})